#!/bin/bash

#Create Project folder structure:

#function update_scripts {
#
#	}

function create_project_folders {
    mkdir -p "${p_location}";
	mkdir -p "${p_location}/assets";
	mkdir -p "${p_location}/final";
	mkdir -p "${p_location}/making_of";
	mkdir -p "${p_location}/pre_production";
	mkdir -p "${p_location}/refs";
	mkdir -p "${p_location}/scripts";
	mkdir -p "${p_location}/scripts/conf";
	mkdir -p "${p_location}/scripts/template_documents";
#	mkdir -p "${p_location}/shots";
	mkdir -p "${p_location}/spaghetti"
	mkdir -p "${p_location}/spaghetti/launchers"
	mkdir -p "${p_location}/temp";
	mkdir -p "${p_location}/timetracker";
	mkdir -p "${p_location}/tools";
	mkdir -p "${p_location}/transfer";
	mkdir -p "${p_location}/transfer/incoming";
	mkdir -p "${p_location}/transfer/outgoing";
	}
	
function create_task_folders {
	mkdir -p "${t_path}/usr";
	mkdir -p "${t_path}/lib";	
	mkdir -p "${t_path}/output";
	mkdir -p "${t_path}/input";
	}

function copy_asset_template {
	cp "${s_root}/${s_new_asset_template}" "${p_location}/scripts/create_new_asset.command";
	chmod a+rwx "${p_location}/scripts/create_new_asset.command";
#	ln -s "${p_location}/scripts/create_new_asset.command" "${p_location}/assets/Create New Asset";
	}
	
function copy_asset_link_template {
	cp ${s_root}/${s_new_asset_link_template} ${p_location}/scripts/create_new_asset_link.command;
	chmod a+rwx ${p_location}/scripts/create_new_asset_link.command;
#	ln -s ${p_location}/scripts/create_new_asset.command "${p_location}/assets/Create New Asset Link";
#	ln -s ${p_location}/scripts/create_new_asset.command "${p_location}/shots/Create New Asset Link";
	}	

function copy_task_template {
	cp "${s_root}/${s_new_task_template}" "${p_location}/scripts/create_new_task.command";
	chmod a+rwx "${p_location}/scripts/create_new_task.command";
	}
	
function copy_duplicate_task_template {
	cp "${s_root}/${s_duplicate_task_template}" "${p_location}/scripts/duplicate_task.command";
	chmod a+rwx "${p_location}/scripts/duplicate_task.command";
	}
	
function copy_output_template {
	cp "${s_root}/${s_new_output_template}" "${p_location}/scripts/create_new_output.command";
	chmod a+rwx "${p_location}/scripts/create_new_output.command";
	}
	
#function copy_asset_output_template {
#	cp "${s_root}/${s_new_asset_output_template}" "${p_location}/scripts/create_asset_output.command";
#	chmod a+rwx "${p_location}/scripts/create_asset_output.command";
#	}

function copy_outputversion_template {
	cp "${s_root}/${s_new_outputversion_template}" "${p_location}/scripts/create_new_outputversion.command";
	chmod a+rwx "${p_location}/scripts/create_new_outputversion.command";
	}
	
function copy_input_template {
	cp "${s_root}/${s_new_input_template}" "${p_location}/scripts/create_new_input.command";
	chmod a+rwx "${p_location}/scripts/create_new_input.command";
	}

function copy_publish_template {
	cp "${s_root}/${s_new_publish_template}" "${p_location}/scripts/create_new_publish.command";
	chmod a+rwx "${p_location}/scripts/create_new_publish.command";
	}
	
#function copy_shot_template {
#	cp "${s_root}/${s_new_shot_template}" "${p_location}/scripts/create_new_shot.command";
#	chmod a+rwx "${p_location}/scripts/create_new_shot.command";
#	ln -s "${p_location}/scripts/create_new_shot.command" "${p_location}/shots/Create New Shot";
#	}
	
function copy_set_final_template {
	cp "${s_root}/${s_set_final_template}" "${p_location}/scripts/set_final.command";
	chmod a+rwx "${p_location}/scripts/set_final.command";
#	ln -s "${p_location}/scripts/set_final.command" "${p_location}/final/Set Final";
	}
	
function copy_run_task {
	cp "${s_root}/${s_run_task_template}" "${p_location}/scripts/run_task.command";
	chmod a+rwx "${p_location}/scripts/run_task.command";
	}

function copy_template_documents {
	cp -r "${d_root}" "${p_location}/scripts/template_documents";
	chmod -R a+rwx "${p_location}/scripts/template_documents";
	}
	
function copy_tasks_tools_outputs {
	cp "${s_root}/${s_tasks_template}" "${p_location}/scripts/tasks";
	cp "${s_root}/${s_tools_template}" "${p_location}/scripts/tools";
	cp "${s_root}/${s_outputs_template}" "${p_location}/scripts/outputs";
	}
	
function copy_run_pili {
	cp "${s_root}/${s_run_pili_template}" "${p_location}/scripts/run_pili.command";
	chmod a+rwx "${p_location}/scripts/run_pili.command";
	cd ${p_location};
	ln -sfn "./scripts/run_pili.command" "Run Pili (${p_name})";
#	ln -s "${p_location}/scripts/run_pili.command" "${p_location}/Run Pili";
	}

function copy_generate_network {
	cp "${s_root}/${s_generate_network_template}" "${p_location}/scripts/generate_network.command";
	chmod a+rwx "${p_location}/scripts/generate_network.command";
	}
	
function copy_correspondence_template {
	cp "${s_root}/${s_generate_network_template}" "${p_location}/scripts/create_new_correspondence.command";
	chmod a+rwx "${p_location}/scripts/create_new_correspondence.command";
	}
	
function copy_screencapture {
	cp "${s_root}/${s_screencapture_template}" "${p_location}/scripts/screencapture.command";
	chmod a+rwx "${p_location}/scripts/screencapture.command";
	}
	
function copy_timetracker {
	cp "${s_root}/${s_timetracker_template}" "${p_location}/scripts/timetracker.command";
	chmod a+rwx "${p_location}/scripts/timetracker.command";
	}
	
function copy_spaghetti_refresher {
	cp "${s_root}/${s_spaghetti_refresher_template}" "${p_location}/scripts/spaghetti_refresher.command";
	chmod a+rwx "${p_location}/scripts/spaghetti_refresher.command";
	}